package com.set.treeset;

import java.util.*;

class Employee implements Comparator{
	int id;
	String name;
	Employee(int id,String name){
		this.id=id;
		this.name=name;
	}
	public String toString(){
		return id+"\t"+name;
	}
	public int compare(Object obj1,Object obj2){
		String s1=obj1.toString();
		String s2=(String)obj2;
		return -s1.compareTo(s2);
	}
}
public class Comprator1 {
public static void main(String[] args) {
	Employee e1=new Employee(101, "surya");
	Employee e2=new Employee(109, "ajay");
	Employee e3=new Employee(106, "vijy");
	Employee e4=new Employee(100, "deepak");
	TreeSet t=new TreeSet();
	t.add(e1);
	t.add(e2);
	t.add(e3);
	t.add(e4);
	System.out.println(t);
}
}
